package com.jadcon.webapp.web;

import java.net.URL;

import javax.xml.namespace.QName;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.intalio.ws.timeservice.TimeService;
import com.intalio.ws.timeservice.TimeServiceSoap;
import com.jadcon.webapp.domain.Time;

@Controller
public class BasicController {

	private static final QName SERVICE_NAME = new QName(
			"http://ws.intalio.com/TimeService/", "TimeService");
	URL wsdlURL = TimeService.WSDL_LOCATION;
	TimeService ss = new TimeService(wsdlURL, SERVICE_NAME);
	TimeServiceSoap port = ss.getTimeServiceSoap();

	@RequestMapping("/index.html")
	public ModelAndView index() {
		ModelAndView mav = new ModelAndView("index");
		String cityTime = "Philadelphia";
		String currentTime = port.getCityTime(cityTime);
		Time time = new Time();
		time.setTime(currentTime);
		mav.addObject(time);
		return mav;
	}

}
